package common;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import db.DBManager;

public class Receipt_Select {
	
	public static boolean Receipt_Select(String order_num){
		Connection con = null;
		
		
		String sql = "select * from order_info where num = "+ order_num +";";
		boolean select = false;
		try{	
				System.out.println(sql);
				System.out.println("メソッド通過しました。");
				Statement stm = null;
				ResultSet rs = null;
				con = DBManager.getConnection();//DBManeger
				stm = con.createStatement();
				rs = stm.executeQuery(sql);
				
				int judge= 0;
				
				if(rs.next()){
					
					judge =rs.getInt("judge");
					
				}
				
				if(judge==0){
					select=false;
					System.out.println("NG");
				}
				if(judge==1){
					select=true;
					System.out.println("OK");
				}
			rs.close();
			stm.close();
			con.close();
		}
		catch(SQLException e){
			e.printStackTrace();
		}
		
		return select;
	}
	
	
	
}
